package org.bjtu.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;

import com.janus.util.RequestHelper;

public class GovMemberAction extends DispatchAction {
	public GovMemberAction() {
	}


	public ActionForward list(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {

		System.out.println("listAction");

		return mapping.findForward("list");
	}
	
	public ActionForward edit(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
//		request.getParameter("id");
		System.out.println("editAction");
		return mapping.findForward("edit");
	}
	
	public ActionForward add(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		System.out.println("addAction");
		return mapping.findForward("add");
	}

	public ActionForward detail(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		String id = request.getParameter("id");
		System.out.println(id);
//		use id to get detail info
		System.out.println("detailOrgAction");
		return mapping.findForward("detail");
	}

	public ActionForward saveOrUpdate(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {

		RequestHelper rh = new RequestHelper(request);

		long stndPosId = rh.getlongValue("stndPosId");
//		position.setPossubcluster(possubcluster);
//
//		Global.getStndpositionService().saveOrUpdate(position);
		try {
			response.sendRedirect("cusPosAction.do?method=list");
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
		return null;
	}

	

	public ActionForward save(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		
		System.out.println("saveAction");
		try {
			response.sendRedirect("govMemberAction.do?method=list");
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
		return null;
	}
	
	public ActionForward cancel(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		System.out.println("cancelAction");

		try {
			response.sendRedirect("govMemberAction.do?method=list");
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
		return null;
	}
	
	public ActionForward outputExcel(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		
		System.out.println("outputExcelAction");
		try {
			response.sendRedirect("govMemberAction.do?method=list");
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
		return null;
	}

	public ActionForward doQuery(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		
		System.out.println("doQueryAction");
		
		return mapping.findForward("list");
	}
	
	public ActionForward delete(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		String id = request.getParameter("id");
		System.out.println(id);
//		use id to get detail info
		System.out.println("deleteAction");
		return mapping.findForward("list");
	}

}
